﻿using Shop.RemoteModel.GoodsSpec;
using Shop.RemoteModel.GoodsSpec.Model;
using Shop.Service.Interface;
using WeDonekRpc.Client.Interface;

namespace Shop.Service.RpcEvent
{
    internal class SpecGroupEvent : IRpcApiService
    {
        private readonly ISpecGroupService _Service;

        public SpecGroupEvent (ISpecGroupService service)
        {
            this._Service = service;
        }
        public void DeleteSpecGroup (DeleteSpecGroup obj)
        {
            this._Service.DeleteGroup(obj.Id);
        }
        public long AddSpecGroup (AddSpecGroup obj)
        {
            return this._Service.AddGroup(obj.Datum);
        }
        public bool SetSpecGroup (SetSpecGroup obj)
        {
            return this._Service.SetGroup(obj.Id, obj.Name);
        }
        public void DeleteGoodsSpec (DeleteGoodsSpec obj)
        {
            this._Service.DeleteSpec(obj.Id);
        }
        public void SyncSku (SyncSku obj)
        {
            this._Service.SyncSku(obj.GoodsId);
        }
        public GoodsSpecSku[] GetSkuSpecGroup (GetSkuSpecGroup obj)
        {
            return this._Service.GetSkuSpec(obj.GoodsId);
        }
        public bool SetGoodsSkuState (SetGoodsSkuState state)
        {
            return this._Service.SetSkuState(state.State);
        }
        public GoodsSpecGroup[] GetSpecGroup (GetSpecGroup obj)
        {
            return this._Service.GetGroups(obj.GoodsId);
        }
        public Dictionary<long, int> SetSpecGroupSort (SetSpecGroupSort obj)
        {
            return this._Service.SetGroupSort(obj.Id, obj.Sort);
        }
        public Dictionary<long, int> SetSpecSort (SetSpecSort obj)
        {
            return this._Service.SetSpecSort(obj.Id, obj.Sort);
        }
        public void DeleteSkuSpec (DeleteSkuSpec obj)
        {
            this._Service.DeleteSpec(obj.GoodsId, obj.SpecId);
        }
        public GoodsSpec AddGoodsSpec (AddGoodsSpec add)
        {
            return this._Service.AddSpec(add.Datum);
        }
        public bool SetGoodsSpec (SetGoodsSpec set)
        {
            return this._Service.SetSpec(set.Id, set.Datum);
        }
    }
}
